#!/bin/sh

#
# Test the applying a .fw with an unknown metadata field still succeeds
#
# This should fail if you're using libconfuse version before 3.0. That's
# not the end of the world. You'll just be less accepting of .fw files
# created by future fwup versions in ways that shouldn't matter. See
# the compile warning in cfgfile.c.
#

. "$(cd "$(dirname "$0")" && pwd)/common.sh"

cat >$CONFIG <<EOF
meta-product = "testing test test"
task complete {
}
EOF

$FWUP_CREATE -c -f $CONFIG -o $FWFILE

# Add a field to the meta.conf
unzip_fw
echo "meta-mynewmeta=\"something\"" >> $UNZIPDIR/meta.conf
cd $UNZIPDIR
zip -q $FWFILE.new meta.conf
cd -

# See that it still applies
$FWUP_APPLY -a -d $IMGFILE -i $FWFILE.new -t complete

# Check that the verify logic works on both files
$FWUP_VERIFY -V -i $FWFILE
$FWUP_VERIFY -V -i $FWFILE.new
